package com.cskaoyan.config;


import com.cskaoyan.bean.common.BaseRespVo;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author jzp
 * @since 2022/11/23 15:39
 */

@RestControllerAdvice
public class CustomExceptionControllerAdvice {
    @ExceptionHandler({NullPointerException.class})
    public BaseRespVo method2(Exception exception) {
        exception.printStackTrace();
        BaseRespVo baseRespVo = new BaseRespVo();
        baseRespVo.setErrno(501);
        baseRespVo.setErrmsg("请登录");
        return baseRespVo;
    }
}

